/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tk.eigh.ksvg.component.filter;

import ksvg.core.SVGFilter;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
import tk.eigh.ksvg.types.SVGNumber;

/**
 * <p>This filter primitive creates an image using the Perlin turbulence
 * function. It allows the synthesis of artificial textures like clouds or
 * marble. For a detailed description the of the Perlin turbulence function, see
 * "Texturing and Modeling", Ebert et al, AP Professional, 1994. The resulting
 * image will fill the entire <a
 * href="http://www.w3.org/TR/SVG/filters.html#FilterPrimitiveSubRegion">filter primitive subregion</a>
 * for this filter primitive.</p> <p>It is possible to create bandwidth-limited
 * noise by synthesizing only one octave.</p> <p>The C code below shows the
 * exact algorithm used for this filter effect.</p> <p>For fractalSum, you get a
 * turbFunctionResult that is aimed at a range of -1 to 1 (the actual result
 * might exceed this range in some cases). To convert to a color value, use the
 * formula
 * <code>colorValue = ((turbFunctionResult * 255) + 255) /
 * 2</code>, then clamp to the range 0 to 255.</p> <p>For turbulence, you get a
 * turbFunctionResult that is aimed at a range of 0 to 1 (the actual result
 * might exceed this range in some cases). To convert to a color value, use the
 * formula
 * <code>colorValue = (turbFunctionResult * 255)</code>, then clamp to the range
 * 0 to 255.</p> <p>The following order is used for applying the pseudo random
 * numbers. An initial seed value is computed based on attribute <a
 * href="http://www.w3.org/TR/SVG/filters.html#feTurbulenceSeedAttribute">‘seed’</a>. Then the implementation computes the
 * lattice points for R, then continues getting additional pseudo random numbers
 * relative to the last generated pseudo random number and computes the lattice
 * points for G, and so on for B and A.</p> <p>The generated color and alpha
 * values are in the color space determined by the value of property <a
 * href="http://www.w3.org/TR/SVG/painting.html#ColorInterpolationFiltersProperty">‘color-interpolation-filters’</a>:</p> <pre
 * > /* Produces results in the range [1, 2**31 - 2].
 * Algorithm is: r = (a * r) mod m where a = 16807 and m = 2**31 - 1 =
 * 2147483647 See [Park &amp; Miller], CACM vol. 31 no. 10 p. 1195, Oct. 1988 To
 * test: the algorithm should produce the result 1043618065 as the 10,000th
 * generated number if the original seed is 1.
 * </pre>
 */
@JSFComponent(name = "svg:Turbulence",
type = "tk.eigh.svg.Turbulence",
family = "filter.Turbulence",
clazz = "ksvg.filter.Turbulence",
tagClass = "ksvg.tags.filter.TurbulenceTag",
defaultRendererType = "filter.SVGTurbulenceRenderer")
public abstract class AbstractTurbulence extends SVGFilter {

    /**
     * baseFrequency = "<em><a
     * href="http://www.w3.org/TR/SVG/types.html#DataTypeNumberOptionalNumber">&lt;number-optional-number&gt;</a></em>"<br/>The
     * base frequency (frequencies) parameter(s) for the noise function. If two
     * <a href="http://www.w3.org/TR/SVG/types.html#DataTypeNumber">&lt;number&gt;</a>s are provided, the
     * first number represents a base frequency in the X direction and the
     * second value represents a base frequency in the Y direction. If one
     * number is provided, then that value is used for both X and Y.<br/> A
     * negative value for base frequency is an error (see <a
     * href="http://www.w3.org/TR/SVG/implnote.html#ErrorProcessing">Error processing</a>).<br/> If the
     * attribute is not specified, then the effect is as if a value of 0 were specified.<br/> <a href="http://www.w3.org/TR/SVG/animate.html#Animatable">Animatable</a>:
     * yes.
     */
    @JSFProperty
    public abstract String getBaseFrequency();

    /**
     * numOctaves = "<em><a
     * href="http://www.w3.org/TR/SVG/types.html#DataTypeInteger">&lt;integer&gt;</a></em>"<br/>The
     * numOctaves parameter for the noise function.<br/> If the attribute is not
     * specified, then the effect is as if a value of 1 were specified.<br/> <a href="http://www.w3.org/TR/SVG/animate.html#Animatable">Animatable</a>:
     * yes.
     */
    @JSFProperty
    public abstract Integer getNumOctaves();

    /**
     * seed = "<em><a
     * href="http://www.w3.org/TR/SVG/types.html#DataTypeNumber">&lt;number&gt;</a></em>"<br/>The
     * starting number for the pseudo random number generator.<br/> If the
     * attribute is not specified, then the effect is as if a value of 0 were specified. When the seed number is
     * handed over to the algorithm above it must first be truncated, i.e.
     * rounded to the closest integer value towards zero.<br/> <a href="http://www.w3.org/TR/SVG/animate.html#Animatable">Animatable</a>:
     * yes.
     */
    @JSFProperty
    public abstract SVGNumber getSeed();

    /**
     * stitchTiles = "<em>stitch |
     * noStitch</em>"<br/>If stitchTiles="noStitch", no attempt it made to
     * achieve smooth transitions at the border of tiles which contain a
     * turbulence function. Sometimes the result will show clear discontinuities
     * at the tile borders.<br/> If stitchTiles="stitch", then the user agent will
     * automatically adjust baseFrequency-x and baseFrequency-y values such that
     * the feTurbulence node's width and height (i.e., the width and height of
     * the current subregion) contains an integral number of the Perlin tile
     * width and height for the first octave. The baseFrequency will be adjusted
     * up or down depending on which way has the smallest relative (not
     * absolute) change as follows: Given the frequency, calculate
     * <code>lowFreq=floor(width*frequency)/width</code> and
     * <code>hiFreq=ceil(width*frequency)/width</code>. If frequency/lowFreq
     * &lt; hiFreq/frequency then use lowFreq, else use hiFreq. While generating
     * turbulence values, generate lattice vectors as normal for Perlin Noise,
     * except for those lattice points that lie on the right or bottom edges of
     * the active area (the size of the resulting tile). In those cases, copy
     * the lattice vector from the opposite edge of the active area. <p> If
     * attribute <a href="http://www.w3.org/TR/SVG/filters.html#feTurbulenceStitchTilesAttribute">‘stitchTiles’</a> is not specified, then the
     * effect is as if a value of noStitch were
     * specified. </p><br/> <a
     * href="http://www.w3.org/TR/SVG/animate.html#Animatable">Animatable</a>: yes.
     */
    @JSFProperty
    public abstract String getStitichTiles();

    /**
     * type = "<em>fractalNoise |
     * turbulence</em>"<br/>Indicates whether the filter primitive should
     * perform a noise or turbulence function. If attribute <a
     * href="http://www.w3.org/TR/SVG/filters.html#feTurbulenceTypeAttribute">‘type’</a> is not specified, then the effect is
     * as if a value of turbulence were
     * specified. <br/> <a
     * href="http://www.w3.org/TR/SVG/animate.html#Animatable">Animatable</a>: yes.
     */
    @JSFProperty
    public abstract String getType();
}